#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
    int n, m, x1, x2, y1, y2;
    int arr[2001][2001] = { 0 };
    int i = 0;
    scanf("%d %d", &n, &m);
    for (i = 1; i <= m; i++)
    {
        scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
        int x = 0;
        int y = 0;
        for (x = x1; x <= x2; x++)
        {
            for (y = y1; y <= y2; y++)
            {
                arr[x][y] ^= 1;
            }
        }
    }
    for (i = 1; i <= n; i++)
    {
        int j = 0;
        for (j = 1; j <= n; j++)
        {
            printf("%d", arr[i][j]);
        }
        printf("\n");
    }
    return 0;
}